#  变量的类型注解
import random
from typing import Union

var_1: list[int] = [1, 2, 3]  # int 表明里面存放的都是整数
my_dict: dict[str, int] = {"李白": 18888}  # 字典需要定义key 和value 的类型
my_turtle: tuple[int, str, bool] = (1, "你好", True)  # 元组需要注明每个元素的类型
var_2 = random.randint(1, 10)  # type: int
# 函数类型注解


def add(x: int, y: int):
    return x + y


print(add(111, 222))
my_list: list[Union[str, int, float]] = [1, 2, 3.14159, "你好呀"]


def func(data: Union[str, list]) -> Union[int, str]:
    pass

# 多态


class AC:

    def hot(self):
        #  制热
        pass

    def cool(self):
        # 制冷
        pass

    def swing(self):
        # 扫风
        pass


class GREE_AC(AC):

    def hot(self):
        print("格力科技制热")

    def cool(self):
        print("格力科技制冷")


class Media(AC):

    def hot(self):
        print("美的科技制热")

    def cool(self):
        print("美的科技制冷")


def ac_cool(ac: AC):
    ac.cool()


media_ac = Media()
gree_ac = GREE_AC()
ac_cool(media_ac)
ac_cool(gree_ac)









